package exception;

import enums.http.ResponseCodeEnum;

/**
 * 自定义异常
 */
public class MyApplicationException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	/**
	 * 错误码
	 */
	private String code;

	/**
	 * 异常内容
	 */
	private String msg;

	public MyApplicationException(ResponseCodeEnum en) {
		super(en.getMessage());
		this.msg = en.getMessage();
		this.code = en.getCode();
	}
	public MyApplicationException(ResponseCodeEnum en, String msg) {
		super(msg);
		this.msg = msg;
		this.code = en.getCode();
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "MyApplicationException{" +
				"code='" + code + '\'' +
				", msg='" + msg + '\'' +
				"} " + super.toString();
	}

}
